/**
 * Selling Partner API for Orders
 * Use the Orders Selling Partner API to programmatically retrieve order information. With this API, you can develop fast, flexible, and custom applications to manage order synchronization, perform order research, and create demand-based decision support tools.   _Note:_ For the JP, AU, and SG marketplaces, the Orders API supports orders from 2016 onward. For all other marketplaces, the Orders API supports orders for the last two years (orders older than this don't show up in the response).
 *
 * The version of the OpenAPI document: v0
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 *
 */

import { ApiClient } from '../ApiClient.js'
import { Order } from './Order.js'

/**
 * The OrdersList model module.
 * @module orders_v0/model/OrdersList
 * @version v0
 */
export class OrdersList {
  /**
   * Constructs a new <code>OrdersList</code>.
   * A list of orders along with additional information to make subsequent API calls.
   * @alias module:orders_v0/model/OrdersList
   * @class
   * @param orders {[Order]} A list of orders.
   */
  constructor (orders) {
    this.orders = orders
  }

  /**
   * Constructs a <code>OrdersList</code> from a plain JavaScript object, optionally creating a new instance.
   * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
   * @param {Object} data The plain JavaScript object bearing properties of interest.
   * @param {OrdersList} obj Optional instance to populate.
   * @return {OrdersList} The populated <code>OrdersList</code> instance.
   */
  static constructFromObject (data, obj) {
    if (data) {
      switch (typeof data) {
        case 'string':
          obj = String(data)
          break
        case 'number':
          obj = Number(data)
          break
        case 'boolean':
          obj = Boolean(data)
          break
      }
      obj = obj || new OrdersList()
      if (data.hasOwnProperty('Orders')) { obj.orders = ApiClient.convertToType(data.Orders, [Order]) }
      if (data.hasOwnProperty('NextToken')) { obj.nextToken = ApiClient.convertToType(data.NextToken, 'String') }
      if (data.hasOwnProperty('LastUpdatedBefore')) { obj.lastUpdatedBefore = ApiClient.convertToType(data.LastUpdatedBefore, 'String') }
      if (data.hasOwnProperty('CreatedBefore')) { obj.createdBefore = ApiClient.convertToType(data.CreatedBefore, 'String') }
    }
    return obj
  }
}

/**
 * A list of orders.
 * @member {[Order]} orders
 * @type {[Order]}
 */
OrdersList.prototype.orders = undefined

/**
 * When present and not empty, pass this string token in the next request to return the next response page.
 * @member {String} nextToken
 * @type {String}
 */
OrdersList.prototype.nextToken = undefined

/**
 * Use this date to select orders that were last updated before (or at) a specified time. An update is defined as any change in order status, including the creation of a new order. Includes updates made by Amazon and by the seller. Use [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format for all dates.
 * @member {String} lastUpdatedBefore
 * @type {String}
 */
OrdersList.prototype.lastUpdatedBefore = undefined

/**
 * Use this date to select orders created before (or at) a specified time. Only orders placed before the specified time are returned. The date must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format.
 * @member {String} createdBefore
 * @type {String}
 */
OrdersList.prototype.createdBefore = undefined
